starter.controller('passengerCodeController', function($rootScope,$state,$ionicPopup,$timeout,$scope,Page, localStore,$location) {


    $scope.passenger = localStore.getObject("singlePassengerCode");
    if($scope.passenger == undefined || $scope.passenger.orderId == undefined || $scope.passenger.orderId == "") {
        Page.notice("非法请求!");
        return;
    }

    //生成二维码
    function makeCode(orderStr) {
        $('#passengerCodeDiv').qrcode({
            render: 'canvas',
            text: orderStr,
            height: 200,
            width: $rootScope.screenWidth - 80,
            //logo图片地址
            src: 'img/wx_logo.png'
        });
    }

    Page.ajaxPost("app/order/busCode.do",$scope.passenger,function(resp){
        makeCode(resp.data.orderStr);
    });

    $scope.refreshCode = function() {
        $("#passengerCodeDiv").empty();
        Page.ajaxPost("app/order/busCode.do",$scope.passenger,function(resp){
            makeCode(resp.data.orderStr);
        });
    };

    $scope.backGo = function() {
        $state.go("order_hadPay",{orderId : $scope.passenger.orderId})
    }

});